
$(function () {

    $.ajax({
        url: "../severs/getGoods.php",
        type: "post",
        typeData: "json"
    }).then(function (res) {
        var datas = JSON.parse(res || '[]');
        for (var i = 0; i < datas.length; i++) {
            if (i <= 2) {
                var strHTM = "";
                strHTM += '<li>';
                strHTM += '<div class="content_top_img">' +
                    '<a href="details.html?gid='+datas[i].g_id+'&u_id='+$("#uid").val()+'">' +
                    '<img class="lazy" src="' + datas[i]["0"].I_img1 + '" alt="">' +
                    '</a>' +
                    '</div>';
                strHTM += '<div class="content_top_cot">';
                strHTM += ' <div class="content_top_cot_one">' +
                    '<span>距离团购结束</span>' +
                    '</div>';
                strHTM += ' <div class="content_top_cot_two">' +
                    '<a href="">' + datas[i].g_descri;
                strHTM += '</a>';
                strHTM += '</div>';
                strHTM += '<div class="content_top_cot_three">';
                strHTM += '<p class="mlcb_price fl"><i>￥</i><span>' + datas[i].g_price + '</span><!--<del>￥150.00</del>--></p>';
                strHTM += '<p class="mlcb_btn fr">' +
                    '<a class="put_cart embox" data="' + datas[i].g_data + '" pic="images/contenttop.jpg" ' +
                    'href="javascript:void(0)">加入购物车</a>';
                strHTM += '</p>';
                strHTM += '</div>';
                strHTM += '</div>';
                strHTM += '</li>';
                $(".content_top>ul").append(strHTM);
            } else {
                var strhtml = "";
                strhtml += '<li>';
                strhtml += '<div class="n_list_img">';
                strhtml += '<a href="details.html?gid='+datas[i].g_id+'&u_id='+$("#uid").val() +'">';
                strhtml += '<img class="lazy" src="' + datas[i]["0"].I_img1 + '" alt="" height="100%" width="100%">';
                strhtml += '</a>';
                strhtml += '<div class="hover_a">';
                strhtml += '<a href="" target="_blank">补水</a>';
                strhtml += '<a href="" target="_blank">保湿</a>';
                strhtml += '</div>';
                strhtml += '</div>';
                strhtml += '<div class="n_list_info">';
                strhtml += '<div class="name"><a href="">' + datas[i].g_descri + '</a></div>';
                strhtml += '<div class="info">';
                strhtml += '<p class="p1"><i>￥</i><span>' + datas[i].g_price + '</span>';
                strhtml += '<p class="p2"><a class="put_cart" data="' + datas[i].g_data + '" href="javascript:void(0)">加入购物车</a></p>';
                strhtml += '</div>';
                strhtml += '<div class="tip">';
                strhtml += '<span>距团购结束2天10小时37分34秒</span>';
                strhtml += '</div>';
                strhtml += '</div>';
                strhtml += '</li>';
                $(".n_list>ul").append(strhtml);
            }
        }
    })
})

